<?php

// +----------------------------------------------------------------------
// | MyCentOS
// +----------------------------------------------------------------------
// | Copyright (c) 2014 http://www.mycentos.com, All rights reserved.
// +----------------------------------------------------------------------
// | Author: 琥珀 <317559272@qqq.com><http://www.mycentos.com>
// +----------------------------------------------------------------------
// | @date  : 2015-03-05 14:13:54
// +----------------------------------------------------------------------
// | @Last Modified by:  琥珀
// +----------------------------------------------------------------------
// | @Last Modified time: 2015-03-17 11:21:38
// +-----------------------------------------------------------------------

namespace Admin\Model;
use Think\Model;

/**
 * 用户模型
 * @author 琥珀 (317559272@qq.com)
 */

Class UserModel extends Model
{
    protected $tableName = 'Admin';
    protected $_validate = array(
        array('username', '', '帐号名称已经存在！', 0, 'unique', 1),
        array('repassword', 'password', '确认密码不正确', 0, 'confirm'),);
    protected $_auto = array(
        array('password', 'md5', 1, 'function'),
        array('update_time', 'time', 2, 'function'),
        array('reg_time', 'time', 1, 'function'));
    public function getRealname($uid) {
        return $this->where(array('uid' => (int)$uid))->getField('realname');
    }
}
?>